*******************************************************************************************
*******************************************************************************************
******************** Reclassification Risk in the Small Group Health Insurance Market
******************* by Sebastian Fleitas, Gautam Gowrisankaran and Anthony Lo Sasso 
*******************************************************************************************
*******************************************************************************************
*******************************************************************************************
******************** Table "Other estimates and descriptives in the Text"
*******************************************************************************************
*******************************************************************************************
*******************************************************************************************


cd "~/Dropbox/ReclassificationRisk/"
use database_individual_level.dta, replace 

drop if year!=2013
sort indv_id
merge indv_id using torobustnessACGscore.dta

bys customer_number year: egen mean_usic_score = mean(lagged_usic_score)
reg mean_premium mean_usic_score marketdum* if year==2013 & firmstays==1, vce(cluster customer_number)
gen sample_usic = e(sample)
reg mean_premium mean_pred_riskscore_rp marketdum* if year==2013 & firmstays==1 & sample_usic==1, vce(cluster customer_number)
gen sample_usic2 = e(sample)
reg mean_premium mean_usic_score marketdum* if year==2013 & sample_usic2==1 & firmstays==1, vce(cluster customer_number)

exit 

reg mean_pred_riskscore_rp mean_usic_score
predict double resid, residuals
sum resid 

gen variance = .3975286^2

display 436/(.52/(.52+.16)) 

exit 

corr mean_pred_riskscore_rp mean_usic_score

corr laggedscore lagged_usic_score
spearman laggedscore lagged_usic_score
